package com.sky.mapper;

import com.sky.dto.GoodsSalesDTO;
import com.sky.entity.OrderDetail;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

@Mapper
public interface OrderDetailMapper {

    void insert(@Param("orderDetail") ArrayList<OrderDetail> orderDetail);

    /**
     * 根据订单id查详情
     * @param orderId
     * @return
     */
    @Select("select * from order_detail where order_id = #{orderId}")
    List<OrderDetail> getByOrderId(Long orderId);

    /**
     * 菜品营销数量统计
     * @param begin
     * @param end
     * @return
     */
    List<GoodsSalesDTO> selectNameAndSumNumber(LocalDateTime begin, LocalDateTime end);
}
